//
//  NRWCarPublicNoticeController.m
//  New_Runway
//
//  Created by mack on 2018/1/24.
//  Copyright © 2018年 NelsonJ. All rights reserved.
//

#import "NRWCarPublicNoticeController.h"
#import "UITableView+FDTemplateLayoutCell.h"
#import "NRWCarPublicNoticeDetailCell.h"

@interface NRWCarPublicNoticeController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic, strong) UITableView *tableview;

@end

@implementation NRWCarPublicNoticeController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    if (self.notieModel) {
        self.navigationBarView.titleLabel.text = @"公告详情";
    } else {
        self.navigationBarView.titleLabel.text = @"通知详情";
    }
    
    self.view.backgroundColor = kColorWhite();
    [self initTableview];
}

-(void)initTableview{
    kSelfWeak;
    self.tableview = [[UITableView alloc] init];
    self.tableview.delegate = self;
    self.tableview.dataSource = self;
    self.tableview.backgroundColor = MAIN_BAR_COLOR();
    self.tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.tableview registerNib:[UINib nibWithNibName:@"NRWCarPublicNoticeDetailCell" bundle:nil] forCellReuseIdentifier:@"NRWCarPublicNoticeDetailCell"];
    
    
    [self.view addSubview:self.tableview];
    [self.tableview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(weakSelf.view);
        make.top.equalTo(weakSelf.view).mas_offset(self.navH);
        make.bottom.equalTo(weakSelf.view).mas_offset(-self.BotH);
    }];
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (self.notieModel) {
        
        return [tableView fd_heightForCellWithIdentifier:@"NRWCarPublicNoticeDetailCell" configuration:^(NRWCarPublicNoticeDetailCell* cell) {
            cell.model = self.notieModel;
        }];
    } else {
        
        return [tableView fd_heightForCellWithIdentifier:@"NRWCarPublicNoticeDetailCell" configuration:^(NRWCarPublicNoticeDetailCell* cell) {
            cell.pushMsgModel = self.pushMsgModel;
        }];
    }
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
        
    NRWCarPublicNoticeDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:@"NRWCarPublicNoticeDetailCell"];
    
    if (self.notieModel) {
        cell.model = self.notieModel;
    } else {
        cell.pushMsgModel = self.pushMsgModel;
    }
    return cell;
    
}

@end
